#!/usr/bin/python
# -*- coding: utf-8 -*-
# @version        : 1.0
# @Creaet Time    : 2022/12/5 16:11 
# @File           : test.py
# @IDE            : PyCharm
# @desc           : 简要说明

import re, requests
from urllib import parse
from settings import RESOURCES_DIR, HEADERS
from urllib.parse import urlparse


link = "9.48 rRx:/ 让你臭宝给你拍# jk # jk制服 # 变装  https://v.douyin.com/hRgaAjV/ 复制此链接，打开Dou音搜索，直接观看视频！"

video_link = re.findall('[a-z]+://[\S]+', link, re.I | re.M)[0]

print(video_link)

start_page = requests.get(url=video_link, headers=HEADERS)
print(start_page.url)
url = urlparse(start_page.url)
print(url)
print(url.path)
print(url.path.split("/"))
print(url.path.split("/")[-2])